Conversation
9ff6382 to
0d54ac7
Compare
0d54ac7 to
a226367
Compare
olehermanse
left a comment
There was a problem hiding this comment.
It's a bit hard to follow the code without seeing the bigger picture, please add:
--validateoption which validates the config and won't spawn in the future when that is implemented.- Some shell tests which use the
--validateoption and prove that it's passing and failing in the right situations. - Some explanation and examples for the feature in the README. Clearly mark it as work in progress.
README.md
Outdated
| ```yaml | ||
| templates: | ||
| ubuntu: | ||
| count: 1 |
There was a problem hiding this comment.
count should be moved to group, not be in template
There was a problem hiding this comment.
Templates is not a real key in the final config, all the names defined in templates get expanded before analyzing the config. Ex:
templates:
mycfengine:
version: 3.27.0
groups:
- myhub:
role: hub
cfengine: mycfengineGets turned into:
groups:
- myhub:
role: hub
cfengine:
version: 3.27.0Also, I believe it makes sense to have "count" inside "spawn", Ex:
groups:
- client1:
role: client
source:
count: 4
mode: spawn
spawn:
provider: vagrant
vagrant:
box: ubuntu/focal64
- client2:
role: client
source:
# count: 4. Here count doesn't make sense, because we have saved hosts
mode: save
hosts: [ 8.8.8.8 ]There was a problem hiding this comment.
Okay, but:
- You say that templates are not "real" keys, but I still think we should show examples that make sense to us and are useful for users. Thus, can you adjust the example to where you use a template to specify the provider and and box name, but you don't specify count inside the template, instead the normal case would be to specify this in the group.
- In your first example there, what decides that mycfengine should be expanded as a template? Is it just based on the fact that the string happens to be matching the name of a template?
- I agree that it doesn't make sense to include count there when you have hosts. count should always be the length of hosts in that case.
There was a problem hiding this comment.
In your first example there, what decides that mycfengine should be expanded as a template? Is it just based on the fact that the string happens to be matching the name of a template?
Yes, exactly. We iterate through all the defined groups, and check if values match with one of the defined template name. If they do match, the value is replaced with the template
548ea20 to
6c8683d
Compare
| return self | ||
|
|
||
|
|
||
| def rgetattr(obj, attr, *args): |
There was a problem hiding this comment.
It is not used for now but it will be used later. It's a getattr that doesn't throw an exception if one of the keys is missing. Ex: rgetattr(obj, "source.spawn.provider")
Signed-off-by: Victor Moene <victor.moene@northern.tech>
6c8683d to
dabfb13
Compare
No description provided.